using Caliburn.Core.Metadata;
using Caliburn.PresentationFramework.ApplicationModel;
using Microsoft.Practices.ServiceLocation;

namespace Cirrostrata.CycleList.CaliburnTest.Presenters
{
    [Singleton(typeof(IShellPresenter))]
    public class ShellPresenter : Navigator, IShellPresenter
    {
        private readonly IServiceLocator _serviceLocator;

        public ShellPresenter(IServiceLocator serviceLocator)
        {
            _serviceLocator = serviceLocator;
        }

        public void Open<T>() where T : IPresenter
        {
            this.Open(_serviceLocator.GetInstance<T>());
        }

        protected override void OnActivate()
        {
            Open<IComplexPresenter>();
        }
    }
}